cmake_minimum_required(VERSION 3.10)
project(MyWxWidgetsApp LANGUAGES CXX)

# 设置 C++ 标准
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(VTK COMPONENTS)

if (NOT VTK_FOUND)
    message(FATAL_ERROR "Unable to find the VTK build folder.")
endif()

# set(wxWidgets_ROOT_DIR E:\\librarys\\wxWidgets)
set(wxWidgets_ROOT_DIR $ENV{WX_ROOT})
# 查找 wxWidgets 库
find_package(wxWidgets REQUIRED COMPONENTS core base)

# 如果找到了 wxWidgets 库
if(NOT wxWidgets_FOUND)
    message(FATAL_ERROR "wxWidgets not found!")
endif()

# 包含 wxWidgets 使用的 CMake 文件
include(${wxWidgets_USE_FILE})

# 添加可执行文件
add_executable(MyWxWidgetsApp main.cpp wxVTKRenderWindowInteractor.cxx)

# 添加 wxWidgets 的头文件路径
target_include_directories(MyWxWidgetsApp PRIVATE ${wxWidgets_INCLUDE_DIRS} ${VTK_INCLUDE_DIRS})

# 链接 wxWidgets 库
target_link_libraries(MyWxWidgetsApp ${VTK_LIBRARIES} ${wxWidgets_LIBRARIES})

vtk_module_autoinit(
    TARGETS MyWxWidgetsApp
    MODULES ${VTK_LIBRARIES}
)

set_target_properties(MyWxWidgetsApp PROPERTIES WIN32_EXECUTABLE ON)